<template>
  <div>
    <div class="top-box">
      <div class="bg-box"><img src="../../../../assets/img/logo-my.png" alt="" width="100%"></div>
      <div class="content-box">
        <div class="user">
          <img :src="user.head_sculpture ? user.head_sculpture : avatar" alt="" width="78">
          <p>{{ user.name }}</p>
        </div>
      </div>
      <!--<div class="message">-->
        <!--<router-link to="/message">-->
          <!--<div class="icon-box"><img src="../../../../assets/img/icon-message.png" alt="" width="100%"></div>-->
          <!--<div class="dot"></div>-->
        <!--</router-link>-->
      <!--</div>-->
    </div>
    <div class="menu">
      <router-link v-for="(item, index) in menus" :key="index" :to="item.path">
        <div class="menu-item">
          <div class="menu-content">
            <div class="icon-title">
              <div class="icon"><img :src="item.icon" alt="" width="100%"></div>
              <div class="title">{{ item.title }}</div>
            </div>
            <div class="arrow"><img src="../../../../assets/img/icon-arrow.png" alt="" width="100%"></div>
          </div>
          <van-divider/>
        </div>
      </router-link>
    </div>
  </div>
</template>

<script>
export default {
  name: 'index',
  data () {
    return {
      menus: [
        {path: '/list/3', icon: require('@/assets/img/icon-menu-student.png'), title: '机构管理'},
        {path: '/list/1', icon: require('@/assets/img/icon-menu-course.png'), title: '教师管理'},
        {path: '/list/2', icon: require('@/assets/img/icon-menu-leave.png'), title: '学生管理'},
        {path: '/index/message', icon: require('@/assets/img/icon-menu-message.png'), title: '消息列表'}
      ],
      user: JSON.parse(sessionStorage.getItem('user')),
      avatar: require('@/assets/img/icon-avatar.png')
    }
  },
  methods: {},
  created () {
  }
}
</script>

<style scoped>
  .top-box{
    position: relative;
  }
  .top-box img{
    display: block;
  }
  .top-box .content-box{
    position: absolute;
    width: 100%;
    height: 100%;
    left: 0;
    top: 0;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 16px;
    box-sizing: border-box;
  }
  .content-box .user{
    text-align: center;
    font-family: PingFangBlod;
    color: #1E1E1E;
    font-size: 18px;
  }
  .message{
    position: absolute;
    top: 16px;
    right: 10px;
    width: 30px;
    height: 30px;
  }
  .message .icon-box{
    padding: 3px;
    box-sizing: border-box;
    background-color: rgba(0,0,0,.3);
    border-radius: 50%;
    overflow: hidden;
  }
  .message .dot{
    width: 8px;
    height: 8px;
    position: absolute;
    background-color: #ee0a24;
    overflow: hidden;
    border-radius: 50%;
    top: 0;
    right: 0;
  }
  .menu{
    padding-bottom: 50px;
  }
  .menu-item{
    height: 76px;
  }
  .menu-item .van-divider{
    margin: 0;
  }
  .menu-content{
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 75px;
  }
  .menu-content .icon-title{
    display: flex;
    align-items: center;
  }
  .icon-title .icon{
    width: 28px;
    height: 28px;
    margin-right: 20px;
  }
  .icon-title .title{
    color: #1E1E1E;
    font-size: 16px;
    font-family: PingFangBlod;
  }
  .user img{
    border-radius: 50%;
    overflow: hidden;
  }
</style>
